package com.jnkj.demo.controller;

import com.jnkj.demo.Dao.ClassesDao;
import com.jnkj.demo.Dao.StudentsDao;
import com.jnkj.demo.pojo.Students;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class Khcontroller {
    @Autowired
    private StudentsDao studentsDao;
    @Autowired
    private ClassesDao classesDao;
    @RequestMapping("addStudent")
    @ResponseBody
    public String getHello() {
        Students students=new Students();
        students.setStatusid("200");
        students.setSname("sfj");
        students.setSsex("ada");
        students.setSage(18);
        students.setSpnumber("111111111");
        students.setSbanji("ff");
        studentsDao.addStudent(students);
        return "hello";
    }
    @RequestMapping("updStudent")
    @ResponseBody
    public String updStudent(){
      Students students=new Students();
      students.setSname("wlove");
      students.setStatusid("200");
      studentsDao.updStudent(students);
      return "修改成功";
    }
    @RequestMapping("delStudent")
    @ResponseBody
    public String delStudent(String statusid){
        Students students=new Students();
        students.setStatusid("200");
        studentsDao.del("200");
        return "删除成功";
    }
    @RequestMapping("selectStudents")
    @ResponseBody
    public String selectStudents(){
        studentsDao.select();
        return"查询成功";
    }
    @RequestMapping("dddd")
    @ResponseBody
    public String dddd(String statusid) {
        studentsDao.dbselect("101");
            return "查询信息成功";
    }
    //2
    @RequestMapping("selecta2")
    @ResponseBody
    public String selecta2(){
       studentsDao.select2();
        return"查询成功";
    }
    //3
    @RequestMapping("selecta3")
    @ResponseBody
    public String selecta3(){
        studentsDao.select3();
        return"查询成功";
    }
    //4
    @RequestMapping("selecta5")
    @ResponseBody
    public String selecta5(){
        studentsDao.select5();
        return"查询成功";
    }
    //10
    @RequestMapping("selecta10")
    @ResponseBody
    public String selecta10(String statusid){
     studentsDao.select10("111");
        return"查询结果";
        }
@RequestMapping("selecta11")
    @ResponseBody
    public String selecta11(){
        studentsDao.select11();
        return"查询成功";
}
//    @RequestMapping("upd15")
//    @ResponseBody
//    public String upd15(){
//        Students students=new Students();;
//        students.setStatusid("孙七");
//        studentsDao.updClasses(students);
//        return "修改成功";
//    }
}
